#pragma once
#include "NameNode.grpc.pb.h"
#include <grpcpp/grpcpp.h>
#include <memory>
#include<algorithm>
#include <iostream>
#include<string>
#include <strstream>
class ServiceImpl:public Rpc::Cli2Master::Service {
    public:                                                                                                              
    grpc::Status FindAddr(grpc::ServerContext*  context,const Rpc::FindAddrRequest* request,Rpc::FindAddrReply* response) override
    {

    }
    grpc::Status GetWriteAddr(grpc::ServerContext*  context,const Rpc::GetWriteAddrRequest* request,Rpc::GetWriteAddrReply* response) override
    {

    }
    grpc::Status Stat(grpc::ServerContext*  context,const Rpc::StatRequest* request,Rpc::StatReply* response) override
    {

    }
     grpc::Status Rename(grpc::ServerContext*  context,const Rpc::RenameRequest* request,Rpc::RenameReply* response) override
    {

    }
    grpc::Status Delete(grpc::ServerContext*  context,const Rpc::DeleteRequest* request,Rpc::DeleteReply* response) override
    {

    }
    grpc::Status Mkdir(grpc::ServerContext*  context,const Rpc::MkdirRequest* request,Rpc::MkdirReply* response) override
    {

    }
     grpc::Status GetSubDirNames(grpc::ServerContext*  context,const Rpc::GetSubDirNamesRequest* request,Rpc::GetSubDirNamesReply* response) override
    {

    }
};

int loop(void* m)
 {
   // 服务构建器，用于构建同步或者异步服务
 
   grpc::ServerBuilder builder;
   // 添加监听的地址和端口，后一个参数用于设置认证方式，这里选择不认证
   builder.AddListeningPort("0.0.0.0:33333",grpc::InsecureServerCredentials());
  // 创建服务对象
   ServiceImpl service;
  // 注册服务
   builder.RegisterService(&service);
  // 构建服务器
   std::unique_ptr<grpc::Server> server(builder.BuildAndStart());
    
   std::cout<<"Server Runing"<<std::endl;
   // 进入服务处理循环（必须在某处调用server->Shutdown()才会返回）
   server->Wait();
    return 0;
 }              